package com.museum.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.museum.entity.DO.User;
import com.museum.entity.DTO.RedisInfo.UserMessage;
import com.museum.entity.DTO.user.userAreaDTO;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author Ruiwen
 * @since 2020-12-19
 */
@Repository
public interface UserMapper extends BaseMapper<User> {
    @Select("select user_status from user where user_name = #{userName} and user_password = #{userPassword}")
    Integer getStatus(String userName, String userPassword);

    @Select("select user_id,area_number from user where user_name = #{userName} and user_password = #{userPassword} and is_deleted=0")
    UserMessage userLoginByName(String userName, String userPassword);

    userAreaDTO getUserInfoByIds(HashMap<String, Object> map);

    List<Integer> getUserPermissionsById(Integer userID);

    @Select("select user_name from user where user_id = #{userId}")
    String getUserNameById(Integer userId);

    List<User> selectUserAdmin(Map<String, Object> params);

    @Select("select real_name FROM user where user_id=#{userId}")
    String selectRealName(Integer userId);
}
